package myjava.blocklevelscope;

public class Root {

   public static void main(String[] args) {

      if (true) {
         int foo = 2;
         System.out.print(foo);
      }

      // System.out.println(foo);
      // out of the block where it was defined
      // foo doesn't exist anymore!!! The previous code generates an error

      // but this works
      String amazement = "Jeeeez";
      if (true) {
         System.out.println(amazement);
      }

      // as  well as this shit here ...
      try {
         String amazementExtended = amazement + " that's weird!";
         System.out.println(amazementExtended);
      } catch (Exception e) {
         ;
      } finally {
         int intFinally = 0;
      }

      // but this would too fail ...
      // System.out.println(amazementExteded);
      // System.out.println(intFinally);
   }
}
